var app = getApp();
Page({
    data: {},
    onLoad: function(e) {
        var n = this;
        wx.setNavigationBarColor({
            frontColor: "#ffffff",
            backgroundColor: wx.getStorageSync("color"),
            animation: {
                duration: 0,
                timingFunc: "easeIn"
            }
        }), wx.login({
            success: function(e) {
                var n = e.code;
                wx.setStorageSync("code", n), wx.getUserInfo({
                    success: function(e) {
                        wx.setStorageSync("user_info", e.userInfo);
                        var t = e.userInfo.nickName,
                            a = e.userInfo.avatarUrl;
                        app.util.request({
                            url: "entry/wxapp/openid",
                            cachetime: "0",
                            data: {
                                code: n
                            },
                            success: function(e) {
                                wx.setStorageSync("key", e.data.session_key), wx.setStorageSync("openid", e.data.openid);
                                var n = e.data.openid;
                                app.util.request({
                                    url: "entry/wxapp/Login",
                                    cachetime: "0",
                                    data: {
                                        openid: n,
                                        img: a,
                                        name: t
                                    },
                                    success: function(e) {
                                        wx.setStorageSync("users", e.data), wx.setStorageSync("uniacid", e.data.uniacid)
                                    }
                                })
                            }
                        })
                    },
                    fail: function(e) {
                        wx.getSetting({
                            success: function(e) {
                                0 == e.authSetting["scope.userInfo"] && wx.openSetting({
                                    success: function(e) {}
                                })
                            }
                        })
                    }
                })
            }
        }), console.log(e);
        ! function() {
            var e = new Date,
                n = e.getMonth() + 1,
                t = e.getDate();
            n >= 1 && n <= 9 && (n = "0" + n), t >= 0 && t <= 9 && (t = "0" + t), e.getFullYear(), e.getHours(), e.getMinutes(), e.getSeconds()
        }();
        app.util.request({
            url: "entry/wxapp/CarInfo",
            cachetime: "0",
            data: {
                id: e.id
            },
            success: function(e) {
                console.log(e);
                var t = e.data.pc,
                    a = e.data.tag;
                t.time = app.ormatDate(t.time).slice(5, 16), t.start_time1 = t.start_time.slice(5, 10), t.start_time2 = t.start_time.slice(10, 17), n.setData({
                    pc: t,
                    tag: a
                })
            }
        })
    },
    call_phone: function(e) {
        console.log(e), wx.makePhoneCall({
            phoneNumber: e.currentTarget.dataset.tel
        })
    },
    dizhi1: function(e) {
        var n = this,
            t = Number(n.data.pc.star_lat),
            a = Number(n.data.pc.star_lng);
        console.log(t), console.log(a), wx.openLocation({
            latitude: t,
            longitude: a,
            name: n.data.pc.link_name,
            address: n.data.pc.start_place
        })
    },
    dizhi2: function(e) {
        var n = this,
            t = Number(n.data.pc.end_lat),
            a = Number(n.data.pc.end_lng);
        console.log(t), console.log(a), wx.openLocation({
            latitude: t,
            longitude: a,
            name: n.data.pc.link_name,
            address: n.data.pc.end_place
        })
    },
    shouye: function(e) {
        console.log(e), wx.reLaunch({
            url: "../../index/index",
            success: function(e) {},
            fail: function(e) {},
            complete: function(e) {}
        })
    },
    fabu: function(e) {
        wx.reLaunch({
            url: "../shun",
            success: function(e) {},
            fail: function(e) {},
            complete: function(e) {}
        })
    },
    phone: function(e) {
        var n = e.currentTarget.dataset.tel;
        wx.makePhoneCall({
            phoneNumber: n
        })
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        var e = this;
        console.log(e.data);
        wx.getStorageSync("users").id;
        return {
            title: e.data.yellow_info.company_name,
            path: "/zh_tcwq/pages/shun/shuninfo2/shuninfo2?id=" + e.data.pc.id,
            success: function(e) {},
            fail: function(e) {}
        }
    }
});